home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2005 Utilities
/
CHIP Utilities 2005.7z
/
CHIP Utilities 2005.iso
/
images
/
arachne.igz
/
arachne.img
/
LEVEL0
/
UTILZ.CAB
/
bin
/
Crc.bat
< prev
next >
Wrap
DOS Batch File
|
2005-01-16
|
3KB
|
131 lines
@if "%debug%"=="" echo off
if "%1"==":" if not "%2"=="" goto %2
for %%i in (%tmp%\_crc.*) do if exist %%i del %%i
:: Crc Begin ::
if "%1"=="" goto _end
if not exist %1\nul %0 : _error Could not find '%1'
:_chkvol
dir %srcdrv% >%tmp%\_crc.tmp
lmod [$!]<%tmp%\_crc.tmp >%tmp%\_crc.bak
lmod @set _crc2=[1,8][+]@set _crc=[9,3]<%tmp%\_crc.bak >%tmp%\_crc.bat
set _crc2=
set _crc=
call %tmp%\_crc.bat
for %%i in (nwd NWD nwD nWd Nwd nWD NwD NWd) do if "%_crc%"=="%%i" goto _buildcrc
if not "%2"=="" if "%2"=="%srcdrv%" goto _buildcrc
set _crc2=
set _crc=
goto _end
:_buildcrc
dir %1\*.* /s >%tmp%\_crc.tmp
tfind ":" <%tmp%\_crc.tmp >%tmp%\_crc.bak
tfind /v "<dir>" <%tmp%\_crc.bak >%tmp%\_crc.tmp
tfind /v "%1" <%tmp%\_crc.tmp >%tmp%\_crc.bak
tfind /v /f10,3 "___" <%tmp%\_crc.bak >%tmp%\_crc.tmp
type %tmp%\_crc.tmp >%tmp%\_crc.bak
crc32 %tmp%\_crc.bak >%tmp%\_crc.tmp
lmod @set _crc=[$2]<%tmp%\_crc.tmp >%tmp%\_crc.bat
set _crc=
call %tmp%\_crc.bat
if not "%3"=="" if "%2"=="%3" goto _chkcrc
if not "%2"=="" goto _newcrc
goto _chkcrc
:_chkcrc
if "%3"=="" goto _simple
dir %3 >%tmp%\_crc.tmp
lmod [$!]<%tmp%\_crc.tmp >%tmp%\_crc.bak
lmod @set _crc2=[1,8]<%tmp%\_crc.bak >%tmp%\_crc.bat
set _crc2=
call %tmp%\_crc.bat
:_simple
if not "%_crc2%"=="%_crc%" goto _wrong
if exist %ramdrv%\halt.txt del %ramdrv%\halt.txt >%tmp%\nul
echo CRC: Crc32 '%1' %_crc% (ok)
set _crc2=
set _crc=
goto _end
:_newcrc
for %%i in (a: A: b: B: %ramdrv%) do if "%2"=="%%i" goto _label
goto _env
:_label
if not exist %2\nul goto _env
volume %2%_crc%nwd
echo CRC: Crc32 '%1' %_crc% (imprinted)
set _crc2=
set _crc=
goto _end
:_env
echo CRC: Crc32 '%1' %_crc% (env)
set _crc2=
goto _end
:_wrong
set _crc=
set _crc2=
echo HALT >%ramdrv%\halt.txt
echo CRC: Crc32 '%1' failed (compromised disk)
echo :w_wrong " NwDsk failed Crc32 " [x]>%tmp%\_crc.tmp
echo (%1)>>%tmp%\_crc.tmp
if not exist %ramdrv%\etc\haltcrc.txt goto :_notxt1
type %ramdrv%\etc\haltcrc.txt >>%tmp%\_crc.tmp
echo. >>%tmp%\_crc.tmp
echo [? Ok ] >>%tmp%\_crc.tmp
call w.bat box @%tmp%\_crc.tmp:w_wrong #0
goto _reboot
:_notxt1
if not exist %ramdrv%\etc\stopcrc.txt goto :_notxt2
type %ramdrv%\etc\stopcrc.txt >>%tmp%\_crc.tmp
echo. >>%tmp%\_crc.tmp
echo [ Ok ] [? Cancel] >>%tmp%\_crc.tmp
call w.bat box @%tmp%\_crc.tmp:w_wrong #2
if errorlevel 2 goto _semiend
goto _reboot
:_notxt2
echo This diskette has been compromised >>%tmp%\_crc.tmp
echo Crc32 failed on some files >>%tmp%\_crc.tmp
echo. >>%tmp%\_crc.tmp
echo This session will be aborted >>%tmp%\_crc.tmp
echo. >>%tmp%\_crc.tmp
echo Please replace this diskette or shutdown the PC >>%tmp%\_crc.tmp
echo Press 'Ok' to reboot the PC >>%tmp%\_crc.tmp
echo. >>%tmp%\_crc.tmp
echo [? Ok ] >>%tmp%\_crc.tmp
call w.bat box @%tmp%\_crc.tmp:w_wrong #0
goto _reboot
:_error
shift
shift
echo.
echo CRC (error) %1 %2 %3 %4 %5 %6 %7 %8
echo.
@rem pause
goto _end
:_semiend
set wbat=
set ?=
for %%i in (%tmp%\_crc.*) do if exist %%i del %%i
el! 1
goto _veryend
:_reboot
set wbat=
set ?=
for %%i in (%tmp%\_crc.*) do if exist %%i del %%i
reboot /c
goto _veryend
:_end
set wbat=
set ?=
for %%i in (%tmp%\_crc.*) do if exist %%i del %%i
:_veryend
:: Crc End ::